package file;

import java.io.File;

public class FileDigui {

	public static void main(String[] args) {
		File file=new File("D:"+File.separator);
		listAll(file);

	}
	public static String listAll(File file){
		if(file.isFile()){
			System.out.println(file.getAbsolutePath()+"文件");
			return "";
		}
		String[] files=file.list();
		if(files==null||files.length==0){
			System.out.println(file.getAbsolutePath()+"空目录");
			return"";
		}else{
			System.out.println("目录名"+file.getAbsolutePath());
			for (String string : files) {
				 listAll(new File(file.getAbsoluteFile()+File.separator+string));
			}
			return "";
		}
	}

}
